<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./vue.js"></script>
</head>
<body>
  <div id="app">
    <home></home>
   
  </div>
  <script>
    let CommonTitle = {
      template:`
        <div>
          <h2>我是子组件</h2>
          <slot name="xm"></slot>
          <p>下面结构在不同的组件中使用 不一样</p>
          <slot name="xq"></slot>
        </div>
      `
    }
    let Home = {
      template:`
        <div>
          home页内容 
          <common-title>
             <div slot="xq"> 
                <button>我是小明</button>
              </div>
              <div slot="xm"> 
                <h3>我是小明</h3>
              </div>
             
          </common-title>
        </div>
      `,
      components:{
        CommonTitle
      }
    }
    let News = {
      template:`
        <div>
          news页内容  
          <common-title>
            <button>按钮</button>  
          </common-title>
        </div>
      `,
      components:{
        CommonTitle
      }
    }
    let vm = new Vue({
      el:"#app",
      components:{
        Home,
        News
      }
    })
  </script>
</body>
</html>